CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
PROJECT(Native.Loader)
MESSAGE("Native.Loader from cmake")

#只需要配置几个东西
#1.源码
#收集一个目录下的文件到一个变量 SRC_LIST
AUX_SOURCE_DIRECTORY(./src SRC_LIST)

INCLUDE_DIRECTORIES(./src)
#2.设置输出位置
SET (EXECUTABLE_OUTPUT_PATH ../out)#设置执行文件输出位置
SET (LIBRARY_OUTPUT_PATH ../out)#设置库输出位置

#3.额外的include 和 link 目录
IF (CMAKE_SYSTEM_NAME MATCHES "Windows")

ELSE ()

	MESSAGE("not config other os support for now.")
	
ENDIF()

#4.依赖的链接库
#增加一个链接库
#LINK_LIBRARIES(SDL2)

#5.其它编译选项
MESSAGE("add mydebug #define")
ADD_DEFINITIONS(-DMYDEBUG)

#6.可以顺手copy文件
#IF (CMAKE_SYSTEM_NAME MATCHES "Windows")

#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/sdl2_win_x64_libs/sdl2.dll DESTINATION ../../out/debug)
#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/sdl2_win_x64_libs/sdl2.dll DESTINATION ../../out/release)

#ENDIF()
#7.输出

#增加一个可执行的编译目标
ADD_EXECUTABLE(Native.Loader ${SRC_LIST})

# 允许不安全的代码
target_compile_options(Native.Loader PUBLIC "/unsafe")